![]() |
PATH![]() |
![]() ![]() |
The Repeat (forever) form of the Repeat statement is an infinite loop --a Repeat statement that does not specify when the repetition stops. The only way to exit the loop is by using an Exit statement. For more information, see Exit.
The following example prints each open AppleWorks document, then closes the document window. It uses an Exit statement to exit the loop.
tell application "AppleWorks"
set numberOfDocuments to (count documents)
set i to 1
repeat
if i > numberOfDocuments then
exit repeat
end if
print front document without one copy -- display Print dialog
close front document saving ask -- ask before saving modified doc
set i to i + 1
end repeat
end tell
The phrase without one copy tells an AppleWorks document to display the Print dialog before printing.